<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateUserWechatTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('user_wechat', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('user_id',false)->default(0)->comment('用户id');
            $table->string('unionid',32)->nullable()->comment('微信unionid');
            $table->string('wx_openid',160)->nullable()->index()->comment('微信openid');
            $table->string('wx_nickname',90)->nullable()->comment('微信昵称');
            $table->string('wx_avatar',200)->nullable()->comment('微信头像');
            $table->boolean('wx_issub')->nullable()->default(false)->comment('是否关注');
            $table->timestamps();
            $table->softDeletes();
            $table->engine="InnoDb";
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('user_wechat');
    }
}
